package tests;

import common.Untils;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2025-04-22
 * Time: 16:38
 */
/*
    测试未登录的用例
 */
public class PageByNoLogin extends Untils {
    public static String url = "http://127.0.0.1:8080/client.html";
    public PageByNoLogin() {
        super(url);
    }

    public void ListPageByNoLogin() throws IOException, InterruptedException {
        // 保证未登录状态
        Thread.sleep(1000);
        // 主页未登录处理
        // 处理弹窗
        Alert alert = driver.switchTo().alert();
        alert.accept();
        // 跳转到登录页面
        String expect = driver.getTitle();

        getScreenShot(getClass().getName());

        assert expect.equals("登录页面");

//         driver.quit();
    }
}
